/**
 * 薪资沟通
 */
import React from 'react';
import { history } from 'umi'
import AuthComponent from '@/utils/auth/AuthComponent';

import { HIRE_STATUS_ENUM } from '../../dictionary';

import { Icon } from '../../components';

function HireCommunicateOperate({ candidateId, employId, id, employStatus, ...rest }) {
    const second = employStatus === HIRE_STATUS_ENUM.COMMUNICATING;
    const handleJump = React.useCallback(() => {
        history.push({
            pathname: '/office/personnelManagement/recruitment/hire/communicate',
            // 此处type=hr,只是一个标识，让详情界面知晓此次是二次沟通
            query: { action: 'edit', candidateId, employId, id, type: second ? 'hr' : '' }
        });
    }, [employStatus]);
    return (
        <AuthComponent code="office:recruitment:course:hire:communicate">
            <Icon title={second ? '二次沟通' : '薪资沟通'} type="xinshuigoutong" onClick={handleJump} {...rest} />
        </AuthComponent>
    );
}
export default HireCommunicateOperate;
